//
//  LatestNoticeCell.m
//  Contacts
//
//  Created by 李 雷川 on 14-7-15.
//  Copyright (c) 2014年 李 雷川. All rights reserved.
//

#import "LatestNoticeCell.h"
#import "DateMethod.h"
#import "NoticeCategory.h"
#import "Notice.h"
@implementation LatestNoticeCell
@synthesize thumbImageView,titleLabel,timeLable;
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}

- (void)awakeFromNib
{
    // Initialization code
//    [titleLabel setLineBreakMode:NSLineBreakByTruncatingTail];
//    [titleLabel setNumberOfLines:1];
//    [titleLabel setTextAlignment:NSTextAlignmentLeft];
   
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];
    // Configure the view for the selected state
}
-(void)initWithLatestNotice:(LatestNotice *)_notice{
    latestNotice = _notice;
    if (latestNotice.title.length > 16) {
         [titleLabel setNumberOfLines:0];
    }
    else{
         [titleLabel setNumberOfLines:1];
    }
    titleLabel.text = latestNotice.title;
    Notice *notice = [Notice getNoticeWithID:latestNotice.objID];
    if (notice.content && notice.content.length > 0) {
        titleLabel.textColor = [UIColor lightGrayColor];
    }
    else{
         titleLabel.textColor = [UIColor blackColor];
    }
    timeLable.text = [DateMethod changeDateToMMddTimeToString:latestNotice.time];
    [thumbImageView setImageWithURL:[NSURL URLWithString:latestNotice.iconUrl] placeholderImage:nil];
}
@end
